Dear all, |
Re: Adding "Strikethrough" Markup to Object Heading and Text Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Adding "Strikethrough" Markup to Object Heading and Text Mathias Mamsch - Mon Mar 14 08:53:41 EDT 2011 Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS
Thanks for the link Mathias.
string s = richTextFragment richTextWithOle (object 5)."Object Text"
(object 5)."Object Text" = richText ("{\\rtf1 \\strike " s "}")
|
Re: Adding "Strikethrough" Markup to Object Heading and Text SystemAdmin - Tue Mar 15 07:40:48 EDT 2011
Thanks for the link Mathias.
string s = richTextFragment richTextWithOle (object 5)."Object Text"
(object 5)."Object Text" = richText ("{\\rtf1 \\strike " s "}")
Hmm I tried and I indeed had some issues with bullets (but not exactly the ones you described). They went way, when I added braces {} around the richText string.
string s = richTextFragment richTextWithOle (object 3)."Object Text"
(object 1)."Object Text" = richText ("{\\rtf1 \\strike {" s "}}")
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |
Re: Adding "Strikethrough" Markup to Object Heading and Text
I see Mathias response. I tend to go overboard, so here goes some thoughts. You want to add strike-through code when it becomes "Deleted" and want to remove it when it becomes not "Deleted". Actually, you want to add strike out code only when its not already strike-out, and you want to remove strike-out only when it current IS.
const string c_StrikeOut_Prefix = "{\\rtf1 \\strike {",
c_StrikeOut_Suffix = "}}"
//const string c_StrikeOut_Prefix = "\\strike ",
// c_StrikeOut_Suffix = "\\strike0 "
const int c_StrikeOut_PrefixLen = length(c_StrikeOut_Prefix),
c_StrikeOut_SuffixLen = length(c_StrikeOut_Suffix)
void StrikeOut_Add(Object in_obj)
{
if (null in_obj) return
Buffer bufText = create()
bufText = richTextFragment(richTextWithOle(in_obj."Object Text"))
// bufText = in_obj."Object Text"
int LenText = length(bufText)
print LenText "\t" c_StrikeOut_PrefixLen "\t" c_StrikeOut_SuffixLen "\t[" bufText "]\n"
print "\t=" bufText[0:c_StrikeOut_PrefixLen-1] "=\n"
print "\t=" bufText[LenText - c_StrikeOut_SuffixLen:LenText-1] "=\n"
if(bufText[0:c_StrikeOut_PrefixLen-1] == c_StrikeOut_Prefix and
bufText[LenText - c_StrikeOut_SuffixLen:LenText-1] == c_StrikeOut_Suffix
) return // already StrikeOut
print "Adding...\n"
Buffer bufOut = create()
bufOut += c_StrikeOut_Prefix
combine(bufOut, bufText, 0)
bufOut += c_StrikeOut_Suffix
in_obj."Object Text" = richText(tempStringOf(bufOut))
delete(bufText)
delete(bufOut)
}
void StrikeOut_Remove(Object in_obj)
{
if (null in_obj) return
Buffer bufText = create()
bufText = richTextFragment(richTextWithOle(in_obj."Object Text"))
// bufText = in_obj."Object Text"
int LenText = length(bufText)
print LenText "\t" c_StrikeOut_PrefixLen "\t" c_StrikeOut_SuffixLen "\t[" bufText "]\n"
print "\t=" bufText[0:c_StrikeOut_PrefixLen-1] "=\n"
print "\t=" bufText[LenText - c_StrikeOut_SuffixLen:LenText-1] "=\n"
if(bufText[0:c_StrikeOut_PrefixLen-1] != c_StrikeOut_Prefix or
bufText[LenText - c_StrikeOut_SuffixLen:LenText-1] != c_StrikeOut_Suffix
) return // already StrikeOut
print "Removing...\n"
Buffer bufOut = create()
bufOut += bufText[c_StrikeOut_PrefixLen:LenText - c_StrikeOut_SuffixLen-1]
in_obj."Object Text" = richText(tempStringOf(bufOut))
delete(bufText)
delete(bufOut)
}
Object oCurr = current
if (confirm("Add??")) StrikeOut_Add(oCurr)
elseif (confirm("Remove??")) StrikeOut_Remove(oCurr)
|